package com.linearList;

import org.junit.Before;

import static org.junit.Assert.*;

/**
 * @Author: linKe
 * @Date: 2021/12/30 1:23
 * @FileName: SeqListTest
 * @version: 1.0
 * @Description: 顺序结构链表测试类
 * 也就是数组
 */
public class SeqListTest {

    private SeqList<Integer> list;

    @Before
    public void before(){
        list = new SeqList<>(4);
        list.insert(0,11);
        list.insert(1,12);
        list.insert(2,13);
        list.insert(3,14);
    }


    @org.junit.Test
    public void isEmpty() {
        System.out.println(list.isEmpty());
    }

    @org.junit.Test
    public void size() {
        System.out.println(list.size());
    }

    @org.junit.Test
    public void get() {

        System.out.println(list.get(1));
        System.out.println(list.get(2));
        System.out.println(list.get(3));
        System.out.println(list.get(0));
    }

    @org.junit.Test
    public void set() {
        list.set(1,3333);
        System.out.println(list.get(1));
    }

    /**测试重写的toString*/
    @org.junit.Test
    public void testToString() {
        System.out.println(list.toString());
    }

    @org.junit.Test
    public void insert() {
        int insert = list.insert(4, 15);
        System.out.println(insert);
        System.out.println(list.get(4));
    }

    @org.junit.Test
    public void remove() {
        Integer remove1 = list.remove(3);
        System.out.println(remove1);
    }

    @org.junit.Test
    public void search() {
        int index = list.search(12);
        System.out.println(index);
    }

    @org.junit.Test
    public void testEquals() {
        SeqList<Integer> newList = new SeqList<>(2);
        boolean equals = newList.equals(list);
        System.out.println(equals);
    }
}